<?php
/**
 * 
 * 短信基类...
 * @author Administrator
 *
 */
class helper_sms_base
{
	//短信接口地址
	const APP_URL = 'http://121.14.195.189:87/sendsms.aspx?corpid=souli&password=s3289uli&mobile={$mobile}&content={$content}';
	//手机号码
	protected  $_mobile = NULL;
	//内容
	protected $_content = '';
	
	//返回
	protected  $result = '';
	
	//错误信息
	public  $err_msg = '';
	function __construct($mobile)
	{
		$this->_mobile = $mobile;
	}
	
	function send_message($content)
	{
			$this->_content = $content;
		
			if ($this->_before_send())
			{
				
				$post_url = str_replace('{$mobile}', $this->_mobile, self::APP_URL);
				$this->_content = iconv("UTF-8","GB2312",$this->_content);
				$post_url = str_replace('{$content}', $this->_content, $post_url);
				
				//$this->result = Helper_Common::curl($post_url);
				$this->result = Helper_Common::curl($post_url);
				return $this->_after_send();
			}else 
			{
				return false;
			}
	}
	protected  function _before_send()
	{
		return true;
	}
	protected function _after_send()
	{
		return true;
	}
	/**
	 * 
	 *2012-1-7-上午12:08:57 by 460932465
	 * @return True|false
	 * @param 手机号码|string $mobile
	 * @param 发送内容 $content
	 * @access 直接投递短信
	 */
	static function Post_Message($mobile,$content)
	{
		$sms = new self($mobile);
		return $sms->send_message($content);
	}
}
?>